package com.xbongbong.pro.enums;

import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * 摘要不允许改的业务
 * @author 吴峰
 * @version v1.0
 * @date 2019/7/5 17:20
 * @since v1.0
 */
@Getter
public enum SummaryNotEditEnum {

    /**
     *
     */
    CUSTOMER_COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE),
    SUPPLIER_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE),
    WORKREPORT_DAILY(XbbRefTypeEnum.WORKREPORT_DAILY),
    WORKREPORT_WEEKLY(XbbRefTypeEnum.WORKREPORT_WEEKLY),
    WORKREPORT_MONTHLY(XbbRefTypeEnum.WORKREPORT_MONTHLY),


    ;

    private XbbRefTypeEnum xbbRefTypeEnum;

    SummaryNotEditEnum(XbbRefTypeEnum xbbRefTypeEnum) {
        this.xbbRefTypeEnum = xbbRefTypeEnum;
    }

    public static SummaryNotEditEnum getByType(Integer type) {
        for (SummaryNotEditEnum summaryNotEditEnum: values()) {
            if (Objects.equals(summaryNotEditEnum.getXbbRefTypeEnum().getCode(), type)) {
                return summaryNotEditEnum;
            }
        }
        return null;
    }
}
